<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Vue 2 可配置进度条组件</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.min.js"></script>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }
        
        .progress-container {
            margin: 20px 0;
        }
        
        .progress-bar {
            height: 20px;
            border-radius: 10px;
            background-color: #f0f0f0;
            overflow: hidden;
            position: relative;
        }
        
        .progress-fill {
            height: 100%;
            border-radius: 10px;
            transition: width 0.3s ease, background-color 0.3s ease;
        }
        
        .progress-text {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
        }
        
        .controls {
            margin: 20px 0;
            padding: 15px;
            border: 1px solid #ddd;
            border-radius: 5px;
            background-color: #f9f9f9;
        }
        
        .control-group {
            margin-bottom: 10px;
        }
        
        label {
            display: inline-block;
            width: 100px;
            font-weight: bold;
        }
        
        input[type="range"] {
            width: 200px;
        }
        
        select {
            padding: 5px;
            width: 150px;
        }
        
        .status-success {
            background-color: #4CAF50;
        }
        
        .status-warning {
            background-color: #FFC107;
        }
        
        .status-danger {
            background-color: #F44336;
        }
        
        .status-info {
            background-color: #2196F3;
        }
    </style>
</head>
<body>
    <div id="app">
        <h1>可配置进度条组件</h1>
        
        <!-- 进度条组件 -->
        <div class="progress-container">
            <div class="progress-bar">
                <div 
                    class="progress-fill"
                    :style="{
                        width: progress + '%',
                        backgroundColor: customColor || statusColors[status]
                    }"
                >
                    <div class="progress-text">
                        {{ progress }}%
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 控制面板 -->
        <div class="controls">
            <div class="control-group">
                <label for="progress">进度:</label>
                <input 
                    type="range" 
                    id="progress" 
                    min="0" 
                    max="100" 
                    v-model="progress"
                >
                <span>{{ progress }}%</span>
            </div>
            
            <div class="control-group">
                <label for="status">状态:</label>
                <select id="status" v-model="status">
                    <option value="success">成功</option>
                    <option value="warning">警告</option>
                    <option value="danger">危险</option>
                    <option value="info">信息</option>
                </select>
            </div>
            
            <div class="control-group">
                <label for="customColor">自定义颜色:</label>
                <input 
                    type="color" 
                    id="customColor" 
                    v-model="customColor"
                >
                <span v-if="customColor">{{ customColor }}</span>
                <button 
                    @click="customColor = ''"
                    v-if="customColor"
                >
                    重置颜色
                </button>
            </div>
        </div>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                progress: 50,
                status: 'success',
                customColor: '',
                statusColors: {
                    success: '#4CAF50',
                    warning: '#FFC107',
                    danger: '#F44336',
                    info: '#2196F3'
                }
            }
        });
    </script>
</body>
</html>